<?php
class Admin_model extends CI_Model{
	function __construct(){
		parent::__construct();
		$this->load->library(array('session', 'pagination'));
		$this->load->helper('url');
		$this->load->database();
	}
	
/*
*	Edit By: 阿诺
*	Time : 2015.7.12
*/
	function get_admin_message($username){
		$query = $this->db->query("select * from user where username='$username'");
		return $query->result();
	}
	
	function updata_message($id){
		$password = $this->input->post("password");
		$data = array(
				'password'=>md5($password),
				);
		$this->db->where("id", $id);
		if($this->db->update("user", $data)){
			$flag = true;
		}else{
			$flag = false;
		}
		return $flag;
	}
	
/*
*	Edit By: 阿诺
*	Time : 2015.7.12
*/
	function save_user($u, $p){
		$sql = " insert into user(username, password) values('$u', '$p') ";
		$this->db->query($sql);
	}

}






